/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.ucm;

import assignment_cp3120.dataObjects.AllLocations;
import assignment_cp3120.dataObjects.Flight;
import assignment_cp3120.manager.deleteflights.DeleteFlightsModel;
import assignment_cp3120.manager.deleteflights.DeleteFlightsView;
import assignment_cp3120.manager.editflights.EditFlightsModel;
import assignment_cp3120.manager.editflights.EditFlightsView;
import java.sql.Date;
import java.sql.Time;

/**
 * PRECONDITION: user has entered flight details and pressed edit button
 * 1.System gets the flight to delete from the view
 * 2.System adds edited flight to database
 * 3.System clears the view
 *
 * POSTCONDITION: flight added to database
 *
 * @author Richard Irons
 */
public class UCDeleteFlight implements UseCaseController {
    private DeleteFlightsView view;
    private DeleteFlightsModel model;

    public UCDeleteFlight() {
        this(new DeleteFlightsView(), new DeleteFlightsModel());
    }

    public UCDeleteFlight(DeleteFlightsView view, DeleteFlightsModel model) {
        this.view = view;
        this.model = model;
    }

    public void run() {
        //* 1.System gets the flight to delete from the view
        Flight deleteFlight = view.getDeleteFlight();
        //* 2.System adds flight to the database
        model.deleteFlight(deleteFlight);
        //* 3.System clears the view
        view.clearView();
    }
}
